//
//  LSZContentCollectionViewController.m
//  JKFuYinProject
//
//  Created by 九酷 on 2018/6/6.
//  Copyright © 2018年 LC. All rights reserved.
//

#import "LSZContentCollectionViewController.h"

@interface LSZContentCollectionViewController ()<LCDisplayViewControllerDelegate>

//@property (strong, nonatomic) LCTopTitleImageBar *topTitleImageBar;
@property (strong, nonatomic) UIView *viewFenGe;
@end

@implementation LSZContentCollectionViewController

-(void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
//    _topTitleImageBar.isPushSerach = YES;
}
- (void)viewDidLoad {
    self.title = @"我的收藏";
    self.delegate = self;
    [self setupAllViewController];
    [self setupAllVCData];
    self.view.backgroundColor = [UIColor whiteColor];
    UIView * viewFenGe = [[UIView alloc]initWithFrame:CGRectMake(0, 43+NAVIGATION_BAR_HEIGHT, ScreenWidth, 1)];
    _viewFenGe = viewFenGe;
    viewFenGe.backgroundColor = divider;
    [self.view addSubview:viewFenGe];
    [viewFenGe sendSubviewToBack:self.view];
    /**增加侧滑返回,无其他作用*/
    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 20, ScreenHeight)];
    [self.view addSubview:view];
    [self.view bringSubviewToFront:view];
}
- (void)setupAllViewController {
    // 标题渐变
    // *推荐方式(设置标题渐变)
    [self setUpTitleGradient:^(LCTitleColorGradientStyle *titleColorGradientStyle, UIColor *__autoreleasing *norColor, UIColor *__autoreleasing *selColor) {
        *norColor = RGBColor(140, 140, 140);
        // 设置标题选中颜色
        *selColor = RGBColor(238, 82, 74);
    }];
    // 设置标题字体
    // 推荐方式
    [self setUpTitleEffect:^(UIColor *__autoreleasing *titleScrollViewColor, UIColor *__autoreleasing *norColor, UIColor *__autoreleasing *selColor, UIFont *__autoreleasing *titleFont, CGFloat *titleHeight, CGFloat *titleWidth) {
        // 设置标题字体
        if (ScreenWidth == 414) {
            *titleFont = FONT_(15.5);
        }else
            if (ScreenWidth == 375) {
                *titleFont = FONT_15;
            }else{
                *titleFont = FONT_(14.5);
            }
    }];
}
- (void)setupAllVCData {
    // 移除之前所有子控制器
    [self.childViewControllers makeObjectsPerformSelector:@selector(removeFromParentViewController)];
    NSArray *titleDatas = [[NSArray alloc]init];
    titleDatas = @[@"音频",@"圣经"];
    for (NSInteger i = 0; i < titleDatas.count; i++) {
        if (i == 0) {
//            LSZArticleCollectsViewController *viewController = [[LSZArticleCollectsViewController  alloc]init];
//            viewController.title = titleDatas[i];
//            [self addChildViewController:viewController];
            LSZAudioCollectionViewController * vc = [[LSZAudioCollectionViewController alloc]init];
            vc.title = titleDatas[i];
            [self addChildViewController:vc];
//            [self.navigationController pushViewController:vc animated:YES];
        }
        else if ([titleDatas[i] isEqualToString:@"圣经"]) {
            LSZCollectVC * vc = [[LSZCollectVC alloc]init];
            vc.title = titleDatas[i];
            [self addChildViewController:vc];
        }
        else{
        }
    }
    // 注意：必须先确定子控制器
    [self refreshDisplay];
}
-(void)tabBarContentViewDidSelectItemAtIndex:(NSInteger)index{
    NSLog(@"tabBarContentViewDidSelectItemAtIndex = %zd", index);
}
///标签头部底部分割线
- (void)viewDidLayoutSubviews {
    [super viewDidLayoutSubviews];
    [_viewFenGe sendSubviewToBack:self.view];
}
@end
